package tencent;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;

public class Main5 {
    public static int getRes(int n,long[] a, long[]b){
        HashSet<Long> cache = new HashSet<Long>();
        for (int i=0;i<n;i++){
            for (int j=0;j<n;j++){
                long temp = a[i] + b[j];
                if (cache.contains(temp)){
                    cache.remove(temp);
                }else{
                    cache.add(temp);
                }
            }
        }

        Iterator<Long> iterator = cache.iterator();
        long start = 0;
        if (iterator.hasNext()){
            start = iterator.next();
        }else{
            return 0;
        }
        while (iterator.hasNext()){
            start = start ^ iterator.next();
        }
        return (int)start;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        long[] b=new long[n];
        for (int i=0;i<n;i++){
            a[i] = sc.nextLong();
        }
        for (int i=0;i<n;i++){
            b[i] = sc.nextLong();
        }
        int res = getRes(n, a, b);
        System.out.print(res);

    }
}
